package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.ImageViewDao;
import com.x.erp.manage.ImageViewManage;
import com.x.erp.model.ImageView;
import com.x.erp.rpc.ImageViewRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 图片场景服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.ImageViewRpcService", timeout = 60000)
public class ImageViewService extends BaseService implements ImageViewRpcService {

	@Autowired
	private ImageViewDao ImageViewDao;//图片场景信息DAO

	@Autowired
	private ImageViewManage ImageViewManage;

	/**
	 * 查询图片场景列表
	 * @param imageView
	 * @return
	 */
	@Override
	public List<ImageView> selectImageViewList(ImageView imageView){
		try {
			return ImageViewDao.selectImageViewList(imageView);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询图片场景
	 * @param imageView
	 * @return
	 */
	@Override
	public List<ImageView> selectImageViewListById(ImageView imageView){
		try {
			return ImageViewDao.selectImageViewListById(imageView);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询图片场景数量
	 * @param imageView
	 * @return
	 */
	@Override
	public int selectImageViewNum(ImageView imageView){
		try {
			return ImageViewDao.selectImageViewNum(imageView);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增图片场景信息
	 * @param imageView
	 * @return
	 */
	@Override
	public ImageView insertImageView(ImageView imageView, String[] imageViewTypeList){
		try {
			return ImageViewManage.insertImageView(imageView, imageViewTypeList);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改图片场景信息
	 * @param imageView
	 * @return
	 */
	@Override
	public int updateImageView(ImageView imageView, String[] imageViewTypeList){
		try {
			return ImageViewManage.updateImageView(imageView, imageViewTypeList);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
